!pip install raceplotly
from raceplotly.plots import barplot
Requirement already satisfied: raceplotly in c:\users\user\anaconda3\lib\site-packages (0.1.6) Requirement already satisfied: numpy in c:\users\user\anaconda3\lib\site-packages (from raceplotly) (1.20.1) Requirement already satisfied: pandas in c:\users\user\anaconda3\lib\site-packages (from raceplotly) (1.2.4) Requirement already satisfied: plotly in c:\users\user\anaconda3\lib\site-packages (from raceplotly) (5.4.0) Requirement already satisfied: python-dateutil>=2.7.3 in c:\users\user\anaconda3\lib\site-packages (from pandas->raceplotly) (2.8.1) Requirement already satisfied: pytz>=2017.3 in c:\users\user\anaconda3\lib\site-packages (from pandas->raceplotly) (2021.1) Requirement already satisfied: six>=1.5 in c:\users\user\anaconda3\lib\site-packages (from python-dateutil>=2.7.3->pandas->raceplotly) (1.15.0) Requirement already satisfied: tenacity>=6.2.0 in c:\users\user\anaconda3\lib\site-packages (from plotly->raceplotly) (8.0.1)
import seaborn as sns
import matplotlib.pyplot as plt
%matplotlib inline
#from google.colab import files
#uploaded = files.upload()
import io
import pandas as pd
import numpy as np
#df = pd.read_csv(io.BytesIO(uploaded['vaccinations.csv']))
df=pd.read_csv('C:/Users/user/Downloads/covid-19-data-master/covid-19-data-master/public/data/vaccinations/vaccinations.csv')
print(df)
location iso_code date total_vaccinations \
0 Afghanistan AFG 2021-02-22 0.0
1 Afghanistan AFG 2021-02-23 NaN
2 Afghanistan AFG 2021-02-24 NaN
3 Afghanistan AFG 2021-02-25 NaN
4 Afghanistan AFG 2021-02-26 NaN
... ... ... ... ...
64324 Zimbabwe ZWE 2021-11-22 6433842.0
64325 Zimbabwe ZWE 2021-11-23 6454719.0
64326 Zimbabwe ZWE 2021-11-24 6486873.0
64327 Zimbabwe ZWE 2021-11-25 6513046.0
64328 Zimbabwe ZWE 2021-11-26 6544331.0
people_vaccinated people_fully_vaccinated total_boosters \
0 0.0 NaN NaN
1 NaN NaN NaN
2 NaN NaN NaN
3 NaN NaN NaN
4 NaN NaN NaN
... ... ... ...
64324 3681490.0 2752352.0 NaN
64325 3697233.0 2757486.0 NaN
64326 3719630.0 2767243.0 NaN
64327 3738317.0 2774729.0 NaN
64328 3757352.0 2786979.0 NaN
daily_vaccinations_raw daily_vaccinations \
0 NaN NaN
1 NaN 1367.0
2 NaN 1367.0
3 NaN 1367.0
4 NaN 1367.0
... ... ...
64324 14138.0 34791.0
64325 20877.0 32371.0
64326 32154.0 31085.0
64327 26173.0 28945.0
64328 31285.0 25976.0
total_vaccinations_per_hundred people_vaccinated_per_hundred \
0 0.00 0.00
1 NaN NaN
2 NaN NaN
3 NaN NaN
4 NaN NaN
... ... ...
64324 42.63 24.39
64325 42.77 24.50
64326 42.98 24.65
64327 43.16 24.77
64328 43.36 24.90
people_fully_vaccinated_per_hundred total_boosters_per_hundred \
0 NaN NaN
1 NaN NaN
2 NaN NaN
3 NaN NaN
4 NaN NaN
... ... ...
64324 18.24 NaN
64325 18.27 NaN
64326 18.34 NaN
64327 18.39 NaN
64328 18.47 NaN
daily_vaccinations_per_million daily_people_vaccinated \
0 NaN NaN
1 34.0 1367.0
2 34.0 1367.0
3 34.0 1367.0
4 34.0 1367.0
... ... ...
64324 2305.0 28183.0
64325 2145.0 26013.0
64326 2060.0 24347.0
64327 1918.0 22152.0
64328 1721.0 18876.0
daily_people_vaccinated_per_hundred
0 NaN
1 0.003
2 0.003
3 0.003
4 0.003
... ...
64324 0.187
64325 0.172
64326 0.161
64327 0.147
64328 0.125
[64329 rows x 16 columns]
df.isnull().sum()
location 0 iso_code 0 date 0 total_vaccinations 28016 people_vaccinated 29592 people_fully_vaccinated 32553 total_boosters 56483 daily_vaccinations_raw 33968 daily_vaccinations 345 total_vaccinations_per_hundred 28016 people_vaccinated_per_hundred 29592 people_fully_vaccinated_per_hundred 32553 total_boosters_per_hundred 56483 daily_vaccinations_per_million 345 daily_people_vaccinated 1538 daily_people_vaccinated_per_hundred 1538 dtype: int64
df.isnull()
| location | iso_code | date | total_vaccinations | people_vaccinated | people_fully_vaccinated | total_boosters | daily_vaccinations_raw | daily_vaccinations | total_vaccinations_per_hundred | people_vaccinated_per_hundred | people_fully_vaccinated_per_hundred | total_boosters_per_hundred | daily_vaccinations_per_million | daily_people_vaccinated | daily_people_vaccinated_per_hundred | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | False | False | False | False | False | True | True | True | True | False | False | True | True | True | True | True |
| 1 | False | False | False | True | True | True | True | True | False | True | True | True | True | False | False | False |
| 2 | False | False | False | True | True | True | True | True | False | True | True | True | True | False | False | False |
| 3 | False | False | False | True | True | True | True | True | False | True | True | True | True | False | False | False |
| 4 | False | False | False | True | True | True | True | True | False | True | True | True | True | False | False | False |
| ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
| 64324 | False | False | False | False | False | False | True | False | False | False | False | False | True | False | False | False |
| 64325 | False | False | False | False | False | False | True | False | False | False | False | False | True | False | False | False |
| 64326 | False | False | False | False | False | False | True | False | False | False | False | False | True | False | False | False |
| 64327 | False | False | False | False | False | False | True | False | False | False | False | False | True | False | False | False |
| 64328 | False | False | False | False | False | False | True | False | False | False | False | False | True | False | False | False |
64329 rows × 16 columns
fig, ax = plt.subplots(figsize = (10, 10))
sns.heatmap(df.corr(), cmap = 'BuPu', cbar = True, linewidth = 0.5, annot = True, ax = ax)
plt.show()
df.drop(columns=['people_vaccinated','daily_vaccinations_per_million','people_vaccinated_per_hundred',],inplace=True)
my_raceplot = barplot(df, item_column='location', value_column='daily_vaccinations', time_column='date')
my_raceplot.plot(title='Daily Vaccinations', item_label = 'Country', value_label = 'Daily Vaccination number',
time_label = 'Date: ', frame_duration = 600)